<!-- view for topic detail each tyoe of user will have different method with topic -->

<?php $this->load->view('include/header'); ?>

<?php 
	foreach ($rows as $r){
		//if there are many topics
		if ($r)
			$flag = true;
		else {
			$flag = false;
		}
	}
			
	if ($flag){
		echo "<table border='1'>";
		foreach ($rows as $r){
			echo "<tr>";
			echo "<td>Topic ID</td>";
			echo "<th>".$r->thesis_id."</th>";
			echo "</tr>";
				
			echo "<tr>";
			echo "<td>Name</td>";
			echo "<th>".$r->name."</th>";
			echo "</tr>";
			
			echo "<tr>";
			echo "<td>Research Area</td>";
			echo "<th>".$r->researchArea."</th>";
			echo "</tr>";
			
			echo "<tr>";
			echo "<td colspan='2'>Topic Detail</td>";
			echo "</tr>";
			
			echo "<tr>";
			echo "<td >Description</td>";
			echo "<th width = '100'>".$r->description."</th>";
			echo "</tr>";
			
			echo "<tr>";
			echo "<td>Quantity</td>";
			echo "<th>".$r->quantity_students."</th>";
			echo "</tr>";
			
			echo "<tr>";
			echo "<td>Available</td>";
			echo "<th>".($r->quantity_students - $r->accepted)."</th>";
			echo "</tr>";
			$this->session->set_userdata('topicId',$r->thesis_id);		
			$active = $r->quantity_students - $r->accepted;
		}
		echo "</table>";
		//if user is student, user will have enroll and quit
		if ($this->session->userdata('user_type') == 1){
			if (!$checkStudent){
				if ($active > 0)
					echo anchor('student/enroll','Enroll');
			}
			else
				echo anchor('student/quit','Quit');	
		}
				
		//if user is teacher, user will have modify, delete and list students
		if ($this->session->userdata('user_type') == 2 && $checkTeacher){
			echo anchor('teacher/modify/'.$r->thesis_id,'Edit');
			echo anchor('teacher/delete/'.$r->thesis_id,'Delete');	
		}	
		echo anchor('teacher/viewlist','List');
	}
	else 
		echo '<p>'."No topic is avaiable".'</p>';
?>

<?php $this->load->view('include/footer'); ?>
